﻿@{
    ViewBag.Title = "Form"; 
    Layout = "~/Views/Shared/_Form.cshtml";
}
<script>
    layui.use(['jquery', 'form', 'laydate', 'common','optimizeSelectOption'], function () {
        var form = layui.form,
            $ = layui.$,
            common = layui.common,
            laydate = layui.laydate;
        var keyValue = $.request("keyValue");
        //权限字段
        common.authorizeFields('adminform');
        //此处需修改
        //类型为时间时
        //laydate.render({
            //elem: '#F_Birthday'
            //, btns: ['clear', 'now']
            //, trigger: 'click',
            //format: 'yyyy-MM-dd',
        //});

        $(function () {
            initControl();
            if (!!keyValue) {
                 common.ajax({
                   url: '/SalaryManagement/Personsalary/GetFormJson',
                   dataType: 'json',
                   data: { keyValue: keyValue },
                   async: false,
                   success: function (data) {
                       common.val('adminform', data);
                    }
               });
           }
           form.render();
       });
       wcLoading.close();

       function initControl() {
           //此处需修改
           //绑定数据源
           //类型为下拉框时

              $("#F_BasicSalaryNum").bindSelect({
                  url: "/SalaryManagement/Basicsalary/GetListJson",
                  id: "F_EnCode",
                 text: "F_FullName"
             });
                $("#F_DaySalaryNum").bindSelect({
                    url: "/SalaryManagement/Daysalary/GetListJson",
                   id: "F_EnCode",
                  text: "F_FullName"
              });
                $("#F_JopSalaryNum").bindSelect({
                    url: "/SalaryManagement/Jobsalary/GetListJson",
                   id: "F_EnCode",
                  text: "F_FullName"
              });
                $("#F_WorkAgeSalaryNum").bindSelect({
                      url: "/SalaryManagement/Workagesalary/GetListJson",
                    id: "F_EnCode",
                   text: "F_FullName"
               });
                 $("#F_SkillsSalaryNum").bindSelect({
                      url: "/SalaryManagement/Skillssalary/GetListJson",
                    id: "F_EnCode",
                   text: "F_FullName"
               });
                 $("#F_BenefitSalaryNum").bindSelect({
                       url: "/SalaryManagement/Benefitsalary/GetListJson",
                    id: "F_EnCode",
                   text: "F_FullName"
               });
                   $("#F_PerformanceSalaryNum").bindSelect({
                      url: "/SalaryManagement/Performancesalary/GetListJson",
                    id: "F_EnCode",
                   text: "F_FullName"
               });
       }

       //监听提交
       form.on('submit(saveBtn)', function (data) {
           var postData = data.field;
             if (!postData["F_EnabledMark"]) postData["F_EnabledMark"] = false;
           common.submitForm({
               url: '/SalaryManagement/Personsalary/SubmitForm?keyValue=' + keyValue,
               param: postData,
               success: function () {
                   common.parentreload('data-search-btn');
               }
           })
           return false;
       });
   });
     function search(fileds) {
           layui.use(['jquery', 'form', 'common'], function () {
               var form = layui.form,
                   $ = layui.$,
                   common = layui.common;
               //不同弹窗
               if (fileds == '人员') {
                   common.modalOpen({
                       title: "选择人员",
                           url: "/SystemOrganize/User/AddForm3?name=" + "F_RealName" + "&num="+"F_UserNum"+"&value=" + "F_UserId" + "&ids=" + $('#F_UserId').val(),
                       width: "650px",
                       height: "600px",
                   });
                }
                else  if (fileds == '项目') {
                    common.modalOpen({
                        title: "选择项目",
                                      url: "/WelfaresubsidyManagement/Welfaresubsidy/AddForm?name=" + "F_WelfareSubsidy" + "&value=" + "F_WelfareSubsidyNum" + "&ids=" + $('#F_WelfareSubsidyNum').val(),
                        width: "650px",
                        height: "600px",
                    });
                }

               else {
                   return false;
               }
           });
       }
</script>

<body>
    <div class="layuimini-container">
        <div class="layuimini-main">
            <div class="layui-form layuimini-form" lay-filter="adminform">
                <div class="layui-form-item layui-hide">
                   <label class="layui-form-label required">状态</label>
                   <div class="layui-input-block">
                        <input id="F_EnabledMark" name="F_EnabledMark" type="checkbox" lay-skin="switch" lay-text="开启|关闭" checked value="true">
                    </div>
               </div>
               @*  <div class="layui-form-item layui-hide">
                   <label class="layui-form-label required">编号</label>
                   <div class="layui-input-block">
                        <input type="text" id="F_EnCode" name="F_EnCode" autocomplete="off" lay-verify="required" placeholder="请输入" class="layui-input">
                   </div>
               </div>
                <div class="layui-form-item layui-hide">
                   <label class="layui-form-label required">名称</label>
                   <div class="layui-input-block">
                        <input type="text" id="F_FullName" name="F_FullName" autocomplete="off" lay-verify="required" placeholder="请输入" class="layui-input">
                   </div>
               </div> *@
                <div class="layui-form-item layui-hide">
                   <label class="layui-form-label required">工号</label>
                   <div class="layui-input-block">
                        <input type="text" id="F_UserNum" name="F_UserNum" autocomplete="off" lay-verify="required" placeholder="请输入" class="layui-input" onclick="search('人员')">
                        <input id="F_UserId" name="F_UserId" type="text" hidden />
                    </div>
               </div>
                <div class="layui-form-item layui-hide">
                   <label class="layui-form-label required">姓名</label>
                   <div class="layui-input-block">

                       
                        <input id="F_RealName" name="F_RealName" type="text" lay-verify="required" maxlength="50" autocomplete="off" class="layui-input" />
                    </div>
               </div>
                <div class="layui-form-item layui-hide">
                   <label class="layui-form-label required">薪酬类型</label>
                   <div class="layui-input-block">
                        <select id="F_SalaryTypeNum" name="F_SalaryTypeNum" lay-verify="required" lay-search="">
                            <option value=0>计时制</option>
                            <option value=1>定额制</option>
                            <option value=2>日结制</option>

                        </select>
                   </div>
               </div>
                <div class="layui-form-item layui-hide">
                    <label class="layui-form-label ">日结工资</label>
                    <div class="layui-input-block">
                        <select id="F_DaySalaryNum" name="F_DaySalaryNum" lay-search="">
                            <option value="">==请选择==</option>
                        </select>
                    </div>
                </div>
                <div class="layui-form-item layui-hide">
                   <label class="layui-form-label ">基本工资</label>
                   <div class="layui-input-block">
                        <select id="F_BasicSalaryNum" name="F_BasicSalaryNum" lay-search="">
                            <option value="">==请选择==</option>
                        </select>
                   </div>
               </div>
                <div class="layui-form-item layui-hide">
                   <label class="layui-form-label ">岗位工资</label>
                   <div class="layui-input-block">
                        <select id="F_JopSalaryNum" name="F_JopSalaryNum" lay-search="">
                            <option value="">==请选择==</option>
                        </select>
                    </div>
               </div>
                <div class="layui-form-item layui-hide">
                    <label class="layui-form-label ">技能工资</label>
                    <div class="layui-input-block">
                        <select id="F_SkillsSalaryNum" name="F_SkillsSalaryNum" lay-search="">
                            <option value="">==请选择==</option>
                        </select>
                    </div>
                </div>
                <div class="layui-form-item layui-hide">
                    <label class="layui-form-label ">司龄工资</label>
                    <div class="layui-input-block">
                        <select id="F_WorkAgeSalaryNum" name="F_WorkAgeSalaryNum" lay-search="">
                            <option value="">==请选择==</option>
                        </select>
                    </div>
                </div>
                <div class="layui-form-item layui-hide">
                    <label class="layui-form-label ">效益工资</label>
                    <div class="layui-input-block">
                        <select id="F_BenefitSalaryNum" name="F_BenefitSalaryNum" lay-search="">
                            <option value="">==请选择==</option>
                        </select>
                    </div>
                </div>
                <div class="layui-form-item layui-hide">
                   <label class="layui-form-label ">绩效工资</label>
                   <div class="layui-input-block">
                        <select id="F_PerformanceSalaryNum" name="F_PerformanceSalaryNum" lay-search="">
                            <option value="">==请选择==</option>
                        </select>
                   </div>
               </div>
                <div class="layui-form-item layui-hide">
                   <label class="layui-form-label ">福利补贴</label>
                   <div class="layui-input-block">
                        <input id="F_WelfareSubsidy" name="F_WelfareSubsidy" placeholder="请输入内容" class="layui-textarea" onclick="search('项目')">
                        <input id="F_WelfareSubsidyNum" name="F_WelfareSubsidyNum" type="text" hidden />
                    </div>
               </div>
                
                <div class="layui-form-item layui-hide">
                   <label class="layui-form-label ">备注</label>
                   <div class="layui-input-block">
                        <input type="text" id="F_Description" name="F_Description" autocomplete="off"  placeholder="请输入" class="layui-input">
                   </div>
               </div>
             
                <div class="layui-form-item layui-hide">
                    <button class="layui-btn site-demo-active" lay-submit id="submit" lay-filter="saveBtn">确认保存</button>
                </div>
            </div>
        </div>
    </div>
</body>

